import { RouteRecordRaw } from "vue-router";
const Layout = () => import("@/layout/index.vue");
const IFrame = () => import("@/layout/frameView.vue");

const attendanceRouter: RouteRecordRaw = {
  path: "/attendance",
  name: "Attendance",
  component: Layout,
  meta: {
    title: "考勤管理",
    showLink: false,
    icon: "ri:time-line",
    order: 4
  },
  children: [
    {
      path: "project",
      name: "Project",
      component: () => import("@/views/attendance/project/index.vue"),
      meta: {
        title: "项目管理",
        icon: "ep:folder",
        keepAlive: true
      }
    },
    // 项目详情路由
    {
      path: "project/detail/:id",
      name: "AttendanceProjectDetail",
      component: () => import("@/views/attendance/project/detail.vue"),
      props: true,
      meta: {
        title: "项目详情",
        icon: "ep:view",
        hidden: true,
        activeMenu: "/attendance/project"
      }
    },
    {
      path: "settlement",
      name: "Settlement",
      component: () => import("@/views/attendance/settlement/index.vue"),
      meta: {
        title: "结算单管理",
        icon: "ep:money",
        keepAlive: true
      }
    },
    // 添加订单路由
    {
      path: "order",
      name: "Order",
      component: () => import("@/views/attendance/order/index.vue"),
      meta: {
        title: "订单管理",
        icon: "ep:shopping-cart",
        keepAlive: true
      }
    },
    // 订单详情路由（普通方式）
    {
      path: "order/detail/:id",
      name: "AttendanceOrderDetail",
      component: () => import("@/views/attendance/order/detail.vue"),
      props: true,
      meta: {
        title: "订单详情",
        icon: "ep:view",
        hidden: true,
        activeMenu: "/attendance/order"
      }
    }
    // 删除指向form.vue的路由，因为现在使用对话框组件处理添加和编辑操作
    // 如果需要直接URL访问，可以使用以下注释的方式添加
    /*
    {
      path: "settlement/add",
      name: "SettlementAdd",
      component: () => import("@/views/attendance/settlement/index.vue"),
      props: { action: 'add' },
      meta: {
        title: "新增结算单",
        icon: "ep:plus",
        hidden: true,
        activeMenu: "/attendance/settlement"
      }
    },
    {
      path: "settlement/edit/:id",
      name: "SettlementEdit",
      component: () => import("@/views/attendance/settlement/index.vue"),
      props: route => ({ action: 'edit', id: route.params.id }),
      meta: {
        title: "编辑结算单",
        icon: "ep:edit",
        hidden: true,
        activeMenu: "/attendance/settlement"
      }
    }
    */
  ]
};

export default attendanceRouter;
